package com.question.Design;

import com.question.dao.IPlayerDao;
import com.question.dao.ISeedtimeDao;
import com.question.service.IPlayerService;
import com.question.service.ISeedtimeService;
import com.question.view.Configure;

public class SingletonMode {
	private static IPlayerService playerService;
	private static ISeedtimeService seedtimeService;
	private static IPlayerDao playerDao;
	private static ISeedtimeDao seedtimeDao;
	static {
		try {
			playerDao = (IPlayerDao) Class.forName(Configure.PLAYERDAO).newInstance();
			seedtimeService=  (ISeedtimeService) Class.forName(Configure.SEEDTIMESERVICE).newInstance();
			playerService = (IPlayerService) Class.forName(Configure.PLAYERSERVICE).newInstance();
			seedtimeDao = (ISeedtimeDao) Class.forName(Configure.SEEDTIMEDAO).newInstance();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}
	public static ISeedtimeService getSeedtimeService() {
		return seedtimeService;
	}
	public static IPlayerService getPlayerService() {
		return playerService;
	}
	public static IPlayerDao getPlayDao() {
		return playerDao;
	}
	public static ISeedtimeDao getSeedtimeDao() {
		return seedtimeDao;
	}
}
